<?php
class MemberController extends AppController {
	var $name = 'Member';
	var $helpers = array('Html');
	var $components = array('Init', 'Param');
	var $uses = null;

	function beforeFilter() {
		if (!$this->Session->read('admin')) {
			$this->redirect('/users/login');
		}
		else {
			$this->Init->startup($this);
			$this->Admin = $this->Init->init();

			$this->set('dashboard',0);
			$this->set('content',0);
			$this->set('products',0);
			$this->set('component',1);
			$this->set('system',0);

			$this->set('title','Member Management');
			$this->set('sub_title', $this->Param->getAction($this->params));
  		}
	}

	function index(){
		$this->loadModel('Member');
		$pictures = $this->Member->find('all', array(
										'order' 	 => array('Member.createDate desc')
										));
		$this->set('members',$pictures);
	}

	function edit($id = null){
		$this->loadModel('Member');
		$id = $this->Param->getID($this->params);
		if (isset($id) && ($id > 0)) {
			$this->data = $this->Member->find('first',array(
				'conditions' => array('Member.id' => $id)
			));
		}
		else {
			$this->redirect('/member');
		}
	
	}
}
?>